@extends('admin.layout')

@section('content')
<!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                游戏管理
                <small>编辑</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>游戏管理</a></li>
                <li><a href="#">主页</a></li>
                <li class="active">编辑</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-default">
                        <div class="box-header with-border">
                            <h3 class="box-title">快速编辑</h3>
                        </div><!-- /.box-header -->
                        <!-- form start -->
                        <form role="form" action="{{ url('/admin/games/update') }}/{{$data -> id}}" enctype="multipart/form-data" method="post">
                        {{csrf_field()}}
                            <div class="box-body">
                                @if($errors->any())
                                    <div class="callout callout-info">
                                    <h4>警告</h4>
                                    @foreach($errors->all() as $error)
                                        <p>{{ $error }}</p>
                                    @endforeach
                                  </div>    
                                @endif
                                 
                                <div class="form-group">
                                    <label for="exampleInputEmail1">游戏类名</label>
                                    <select name='pid' class="form-control">
                                        <option value="0">根分类</option>
                                        @foreach($allData as $k => $v)
                                        <option 
                                        @if($data -> pid == $v -> id)
                                            selected='selected'
                                        @endif

                                        @if($v -> pid != 0)
                                        disabled='disabled'
                                        @endif
                                        value="{{ $v -> id}}">{{$v -> name}}</option>
                                        @endforeach
                                     </select>
                                </div>

                                </div><!-- /.box-body -->
                                <div class="form-group">
                                    <label for="exampleInputEmail1">游戏名</label>
                                    <input type="text" name="name" class="form-control" id="exampleInputEmail1"
                                           placeholder="请输入类名" value="{{$data-> name}}">
                                </div>
                                 <div class="form-group">
                                    <label for="exampleInputEmail1">游戏文件</label>
                                    <input type="file" name="file" class="form-control" id="exampleInputEmail1" value="">
                                    <p class="help-block">请选择游戏文件</p>
                                </div> 
                                <div class="form-group">
                                    <label for="exampleInputEmail1">游戏logo</label>
                                    <img src="{{url('/uploads/games/imgs/')}}/{{$data -> time}}/{{$data -> logo}}" width="200" />
                                    
                                    <input type="file" name="logo" class="form-control" id="exampleInputEmail1" value="">
                                    <p class="help-block">请选择游戏logo</p>
                                </div>
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">更新</button>
                            </div>
                        </form>
                    </div><!-- /.box -->

                </div><!--/.col (left) -->
               
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection 